﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MiserBlogMVC.HTTP
{
    public class HTTPResult
    {
        /// <summary>
        /// 执行状态
        /// </summary>
        public bool ExecState { get; set; }

        /// <summary>
        /// 执行后的信息描述
        /// </summary>
        public object ExecContent { get; set; }

        public HTTPResult()
        {

        }
        public override string ToString()
        {
            return ToJSONString(this.ExecState, this.ExecContent);
        }

        public string ToJSONString(bool state, object content)
        {
            object jsonObj = new
            {
                state = state,
                content = content
            };
            return Newtonsoft.Json.JsonConvert.SerializeObject(new { result = jsonObj });
        }
    }
}
